Launch-readiness fixes: generic port detection + clean pm2-missing state#27
Merged
Merged
Conversation
Port detection hardcoded a project-specific GPTZERO_CUSTOM_PORT env var, which has no place in a general-purpose, public tool. Replace it with a generic rule: read the bare PORT or any *_PORT variable (e.g. SERVER_PORT, HTTP_PORT), preferring a specific *_PORT over the generic PORT and breaking ties alphabetically so the result is deterministic regardless of JSON key order. To find these without modelling the whole (secret-bearing) pm2_env, the decoder enumerates env key names but only decodes the values of port-shaped keys, so secret values still never enter memory. Keys that merely contain "port" (SUPPORT_EMAIL, EXPORT_DIR) are ignored, and a non-numeric value falls through to the next candidate. Update the port-extraction tests to cover the generalised behaviour. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018fGGnRAjpLH5EWXNaqYza8
When the pm2 binary can't be resolved (e.g. pm2 isn't installed), refresh() set the error message but returned before marking the first scan complete. The UI then showed the error banner together with the loading skeleton shimmering forever beneath it — a broken-looking first run for anyone without pm2. Mark the first scan complete on resolver failure so the panel settles into a clean error state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018fGGnRAjpLH5EWXNaqYza8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A deep-dive review of the codebase against the reeve launch checklist (Sidetrack project
RVE), focused on the pre-launch QA items (RVE-11: sanity-check empty/error/edge states). Two issues stood out as worth fixing before a public OSS launch; both are small and well-contained.1. Generalise pm2 port detection (
RVE-11)Port detection hardcoded a project-specific
GPTZERO_CUSTOM_PORTenv var — a company-internal name that has no place in a general-purpose, public tool. It's now a generic rule: read the barePORTor any*_PORTvariable (SERVER_PORT,HTTP_PORT, …), preferring a specific*_PORTover the genericPORTand breaking ties alphabetically for deterministic results regardless of JSON key order.GPTZERO_CUSTOM_PORTkeep working (it ends in_PORT), and detection now covers everyone else's conventions too.pm2_env, the decoder enumerates env key names but only decodes the values of port-shaped keys — secret values still never enter memory.SUPPORT_EMAIL,EXPORT_DIR) are ignored; a non-numeric value falls through to the next candidate.2. Clean error state when pm2 isn't installed (
RVE-11)When the pm2 binary couldn't be resolved (e.g. pm2 not installed — a very common first-run state for new users from a launch),
refresh()set the error message but returned before marking the first scan complete. The UI then showed the error banner and the loading skeleton shimmering forever beneath it. Now the first scan is marked complete on resolver failure, so the panel settles into a clean error-only state.Testing
swiftlint --strict,swift build,swift test) is the source of truth. Logic and Codable usage reviewed by hand.Notes for the rest of the checklist
The remaining open launch items are human-owned and out of scope for a code PR: final/draft launch copy (
RVE-7/8/9/15/16), the fresh-install test on a clean Mac (RVE-10), and bumping to v1.0.0 (RVE-12). The staleVERSIONfile (0.1.0) noted inRVE-12is only a fallback inbuild-release.sh; the release workflow always passes the git tag, so I left it for the release step.🤖 Generated with Claude Code
Generated by Claude Code
Summary by cubic
Generalizes
pm2port detection and fixes the endless loading skeleton whenpm2isn’t installed. Improves launch readiness and coversRVE-11sanity checks for empty/error/edge states.New Features
*_PORTorPORT;*_PORTwins, ties sorted alphabetically for deterministic results.GPTZERO_CUSTOM_PORT. Tests updated.Bug Fixes
pm2can’t be resolved, mark the first scan complete so the UI shows a clean error state instead of a forever-loading skeleton.Written for commit ed218c1. Summary will update on new commits.